package com.health.adapter;

import java.util.List;

import com.health.MainActivity_Menu_JTYS;
import com.health.R;
import android.annotation.SuppressLint;
import android.content.Context;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class JTYSHomeAdapter extends BaseAdapter{
	
	private Context context;
	private String[] s ={"儿童","孕产妇","老年人","高血压","糖尿病","重度精神病"};
	private List list;
	public JTYSHomeAdapter(Context context, List list) {
		super();
		this.context = context;
		this.list = list;
	}

	@Override
	public int getCount() {
		return s.length;
	}

	@Override
	public Object getItem(int position) {
		return position;
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@SuppressLint("ResourceAsColor")
	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		ViewHolder holder;
		if (convertView == null) {
			convertView = View.inflate(context, R.layout.jkjy_home_list, null);
			holder = new ViewHolder();
			holder.tv_zdrq = (TextView) convertView.findViewById(R.id.tv_zdrq);
			holder.tv_sfwjx = (TextView) convertView.findViewById(R.id.tv_sfwjx);
			holder.tv_brysf = (TextView) convertView.findViewById(R.id.tv_brysf);
			holder.tv_bzysf = (TextView) convertView.findViewById(R.id.tv_bzysf);
			holder.tv_yqwsf = (TextView) convertView.findViewById(R.id.tv_yqwsf);
			convertView.setTag(holder);
		}else{
			holder = (ViewHolder) convertView.getTag();
		}
		
	
		holder.tv_sfwjx.setText(list.get(position)+"");
		holder.tv_sfwjx.setTextColor(R.color.white);
		holder.tv_brysf.setText(list.get(position)+"");
		holder.tv_brysf.setTextColor(R.color.white);
		holder.tv_bzysf.setText(list.get(position)+"");
		holder.tv_bzysf.setTextColor(R.color.white);
		holder.tv_yqwsf.setText("0");
		holder.tv_yqwsf.setTextColor(R.color.white);
		holder.tv_zdrq.setText(s[position]);
		holder.tv_zdrq.setTextColor(R.color.white);
		holder.tv_sfwjx.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				// 跳转到档案界面
				MainActivity_Menu_JTYS.viewPager.setCurrentItem(2,false);
			}
		});	
		
	
		return convertView;
	}
	
	private class ViewHolder {

		TextView tv_zdrq;// 重点人群
		TextView tv_sfwjx;// 首次随访未进行
		TextView tv_brysf;// 本日应随访
		TextView tv_bzysf;// 本周应随访
		TextView tv_yqwsf;// 逾期未随访
		
	}

}
